<?php

namespace app\validate;

use share\validate\SceneValidate;

class VersionInfoValidate extends SceneValidate
{
    protected $rule = [
        'id' => 'require',
        'type' => 'require|length:2,10',
        'name' => 'require|min:2',
        'language' => 'require|length:2',
        'version' => 'require|number',
        'versionShow' => 'require|length:1,20',
        'version_show' => 'require|length:1,20',
        'md5' => 'require|length:32',
        'uri' => 'require|length:10,255',
        'force' => 'require|min:0|max:1',
        'upgrade' => 'require|number',
        'upgradeType' => 'require|number',
        'appStore' => 'require|number',
        'logs' => 'require|length:1,2000',
        'system' => 'require|length:2,10',
        'package' => 'require|length:2,60',
        'logInfo' => 'require|array'
    ];

    protected $sceneRules = [
        'edit' => [
            'id' => 'require',
            'type' => 'length:2,10',
            'name' => 'min:6',
            'language' => 'length:2',
            'version' => 'length:1,20',
            'versionShow' => 'length:1,20',      
            'md5' => 'length:32',
            'uri' => 'length:10,255',
            'force' => 'min:0|max:1',
            'upgrade' => 'number',
            'upgradeType' => 'number',
            'appStore' => 'number',
            'logs' => 'length:1,2000',           
        ],
        'list' => [
            'type' => 'length:2,10',
            'name' => 'min:6',
            'language' => 'length:2',
            'version' => 'number',
            'force' => 'min:0|max:1',
        ],
    ];

    protected $scene = [
        'get' => ['type', 'name', 'language'],
        'add' => ['type', 'name', 'language', 'version', 'version_show', 'md5', 'uri', 'force', 'logs'],
        'all' => ['system', 'package', 'language'],
        'addVersion' => ['type', 'name',  'version', 'versionShow', 'md5', 'uri', 'force','upgrade','upgradeType', 'appStore','logInfo'],
        'edit' => ['id','type', 'name', 'language', 'version', 'versionShow', 'md5', 'uri', 'force','upgrade','upgradeType', 'appStore', 'logs'],
        'del' => ['id'],
        'list' => ['type','name','version','force']
    ];
}
